// Author: Ivan Kazmenko (gassa@mail.ru)
module solution;
import std.algorithm;
import std.stdio;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		auto a = new int [n];
		foreach (ref c; a)
		{
			readf (" %s", &c);
		}
		int res = a[0];
		foreach (i; 1..n)
		{
			res = max (res, a[i] - a[i - 1]);
		}
		writeln (res);
	}
}
